<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="admin/_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>博客发布</title>
    <link rel="stylesheet" href="../../static/css/me.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
    <link rel="stylesheet" href="../../static/lib/editormd/css/editormd.min.css">

</head>

<body>
<!--<img class="ui fluid image m-background">-->
<!--导航-->
<nav th:replace="admin/_fragments :: menu(1)" class="ui vertical segment m-padded-tb-mini">
    <div class="ui container">
        <div class="ui secondary stackable menu">
            <h2 class="ui violet header item">管理后台</h2>
            <a href="#" class="active m-item violet item m-mobile-hide"><i class="home icon"></i> 博客</a>
            <a href="#" class="m-item violet item m-mobile-hide"><i class="idea icon"></i> 分类</a>
            <a href="#" class="m-item violet item m-mobile-hide"><i class="tags icon"></i> 标签</a>
            <div class="m-item m-mobile-hide right menu">
                <div class="m-item ui dropdown item">
                    <div class="text">
                        <img src="https://unsplash.it/100/100?image=1006" class="ui avatar image">
                        南望
                    </div>
                    <i class="dropdown icon"></i>
                    <div class="m-item menu">
                        <a href="#" class="item">注销</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <a href="#" class="ui menu toggle    icon button m-right-top m-mobile-show">
        <i class="sidebar icon"></i>
    </a>
</nav>
<div class="ui attached menu">
    <div class="ui container">
        <div class="right menu">
            <a href="#"   class="active violet item">发布</a>
            <a href="#" th:href="@{/admin/blogs}" class="violet item">列表</a>
        </div>
    </div>
</div>
<!--    中间内容-->
<div class="m-padded-tb-large m-opacity-mini m-container-small">
    <div class="ui container">
        <form method="post" id="blog-form" action="#" th:object="${blog}" th:action="@{/admin/blogs}" class="ui form">
            <input type="hidden" name="published">
            <input type="hidden" name="id" th:value="*{id}">
            <div class="required field m-shadow-small">
                <div class="ui left labeled input">
                    <div class="ui teal basic label compact selection dropdown">
                        <input type="hidden" value="原创" name="flag" th:value="*{flag}">
                        <i class="dropdown icon"></i>
                        <div class="default text">原创</div>
                        <div class="menu">
                            <div class="item" data-value="原创">原创</div>
                            <div class="item" data-value="转载">转载</div>
                            <div class="item" data-value="翻译">翻译</div>
                        </div>
                    </div>
                    <input type="text" name="title" placeholder="标题" th:value="*{title}">
                </div>
            </div>

            <div class="required field m-shadow-small">
                <div id="md-content" style="z-index: 1 !important;">
                    <textarea th:text="*{content}" name="content" style="display: none" placeholder="博客内容"></textarea>
                </div>
            </div>

            <div class="two fields">
                <div class="required field">
                    <div class="ui left labeled action input m-shadow-small">
                        <label class="ui compact teal basic label">分类</label>
                        <div class="ui fluid selection dropdown">
                            <input type="hidden" name="type.id" th:value="*{type}!=null ? *{type.id}">
                            <i class="dropdown icon"></i>
                            <div class="default text">分类</div>
                            <div class="menu">
                                <div th:each="type : ${types}" class="item" data-value="1" th:data-value="${type.id}" th:text="${type.name}">错误日志</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="field">
                    <div class="ui right labeled action input m-shadow-small">
                        <label class="ui compact teal basic label">标签</label>
                        <div class="ui fluid multiple search selection dropdown">
                            <input type="hidden" name="tagIds" th:value="*{tagIds}">
                            <i class="dropdown icon"></i>
                            <div class="default text">标签</div>
                            <div class="menu">
                                <div th:each="tag : ${tags}" th:data-value="${tag.id}" th:text="${tag.name}" class="item" data-value="1"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="required field">
                <div class="ui left labeled input m-shadow-small">
                    <label class="ui teal basic label">首图</label>
                    <input type="text" name="firstPicture" th:value="*{firstPicture}" placeholder="首图引用地址">
                </div>
            </div>
            <div class="m-shadow-small required field">
                <textarea name="description" th:text="*{description}" placeholder="博客描述。。。" maxlength="200"></textarea>
            </div>
            <div class="inline fields">
                <div class="field">
                    <div class="ui checkbox">
                        <input type="checkbox" th:checked="*{recommend}" name="recommend" checked id="recommend" class="hidden">
                        <label for="recommend" >推荐</label>
                    </div>
                </div>
                <div class="field">
                    <div class="ui checkbox">
                        <input type="checkbox" th:checked="*{shareStatement}" name="shareStatement" id="shareInfo" class="hidden">
                        <label for="shareInfo" >转载声明</label>
                    </div>
                </div>
                <div class="field">
                    <div class="ui checkbox">
                        <input type="checkbox" th:checked="*{commentAble}" name="commentAble" id="commentAble" class="hidden">
                        <label for="commentAble" >评论</label>
                    </div>
                </div>
            </div>

            <div class="ui error message"></div>

            <div class="ui right aligned container">
                <button type="button" class="ui red button" onclick="window.history.go(-1)">返回</button>
                <button type="button" id="save-btn" class="ui blue button">保存</button>
                <button type="button" id="publish-btn" class="ui teal button">发布</button>
            </div>
        </form>
    </div>
</div>
<br>
<br>
<br>
<br>
<br>
<!--    底部-->
<footer th:replace="admin/_fragments :: footer" class="ui    attached segment m-padded-tb-massive">
    <div class="ui center aligned container">
        <div class="ui stackable    divided grid">
            <div class="four wide column">
                <h4 class="ui    header m-opacity-mini">最新博客</h4>
                <div class="ui    link list">
                    <a href="#" class="item">Springboot原理浅析</a>
                    <a href="#" class="item">Leetcode刻意练习</a>
                    <a href="#" class="item">贪吃蛇小游戏</a>
                </div>
            </div>
            <div class="four wide column">
                <h4 class="ui    header m-opacity-mini">最新博客</h4>
                <div class="ui    link list">
                    <a href="#" class="item">Springboot原理浅析</a>
                    <a href="#" class="item">Leetcode刻意练习</a>
                    <a href="#" class="item">贪吃蛇小游戏</a>
                </div>
            </div>
            <div class="eight wide column">
                <h4 class="ui    header m-opacity-mini">关于我</h4>
                <p class="m-opacity-mini">这是我的个人博客，主要记录一些技术笔记。偶尔记录生活和感悟，希望可以帮到每个来到这里的人</p>
            </div>
        </div>
        <div class="ui    section divider"></div>
        <p class="m-text-spaced m-opacity-mini m-text-thin">Copyright @ 2020 - 2021 Saw96x Designed by Saw96x</p>
    </div>
</footer>
<script crossorigin="anonymous" integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT"
        src="https://lib.baomitu.com/jquery/3.3.1/jquery.min.js"></script>
<script th:src="@{/lib/editormd/editormd.min.js}"></script>
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>
<script>
    var contentEditor;

    $(function () {
        contentEditor = editormd("md-content", {
            width: "100%",
            height: 640,
            syncScrolling: "single",
            path: "/lib/editormd/lib/"
        });
    });
    $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-hide');
    });

    $('.ui.dropdown').dropdown({
        on: "hover"
    });

    $('#save-btn').click(function () {
        $('[name="published"]').val(false);
        $('#blog-form').submit();
    });

    $('#publish-btn').click(function () {
        $('[name="published"]').val(true);
        $('#blog-form').submit();
    });



    $('.ui.form').form({
        fields: {
            title: {
                identifier: 'title',
                rules: [{
                    type: 'empty',
                    prompt: '标题:请输入博客标题'
                }]
            },
            content: {
                identifier: 'content',
                rules: [{
                    type: 'empty',
                    prompt: '标题:请输入博客内容'
                }]
            },
            typeId: {
                identifier: 'typeId',
                rules: [{
                    type: 'empty',
                    prompt: '标题:请输入博客分类'
                }]
            },
            firstPicture: {
                identifier: 'firstPicture',
                rules: [{
                    type: 'empty',
                    prompt: '标题:请输入首图地址'
                }]
            },
            description: {
                identifier: 'description',
                rules: [{
                    type: 'empty',
                    prompt: '标题:请输入博客描述'
                }]
            },
        }
    });

</script>
<script type="text/javascript" color="100,149,237" opacity='1' zIndex="-1" count="150"
        src="//cdn.bootcss.com/canvas-nest.js/1.0.1/canvas-nest.min.js"></script>
</body>
</html>


































